package com.aaa.controller;

import com.aaa.entity.Result;
import com.aaa.utils.MyConstants;
import com.aaa.utils.ReturnStatusEnum;

import javax.servlet.http.HttpServlet;

/**
 * @author ：肖成杰（1752167034@qq.com）
 * @date ：Created in 2022/8/9 14:13
 * @description：参数类
 * @modified By：
 * @version:
 */
public class BaseController extends HttpServlet {

    /**
     *  @create by: 肖成杰
     *  @description: 普通成功函数
     *  @create time: 2022/8/11 9:55
     *  @params result
     *  @return void
     *  */
    public Result success()  {
        return new Result(MyConstants.SUCCESS_CODE, MyConstants.SUCCESS_MSG,null,null);

    }
    public Result success(String msg)  {
        return new Result(MyConstants.SUCCESS_CODE,msg,null,null);
    }

    public Result success(Object data) {
        return new Result(MyConstants.SUCCESS_CODE, MyConstants.SUCCESS_MSG,null,data);
    }

    /**
     *  @create by: 肖成杰
     *  @description: 成功并给定总条数 传入数据
     *  @create time: 2022/8/11 9:57
     *  @params msg data
     *  @return void
     *  */
    public Result success(Long count,Object data)  {
        return new Result(MyConstants.SUCCESS_CODE, MyConstants.SUCCESS_MSG,count,data);
    }



    public Result fail() {
        return new Result(MyConstants.FAIL_CODE, MyConstants.FAIL_MSG,null,null);
    }


    public Result fail(String msg)  {
        return new Result(MyConstants.FAIL_CODE,msg,null,null);
    }


}